﻿using Microsoft.Practices.Prism.Mvvm;
using Microsoft.Practices.Prism.PubSubEvents;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Flashlight.Mvvm.Models
{
    public class Light : BindableBase
    {
        IEventAggregator _eventAggregator;
        public Light(IEventAggregator eventAggregator)
        {
            _eventAggregator = eventAggregator;
        }

        Common.States _State = Common.States.Off;
        public Common.States State
        {
            get { return _State; }
            set
            {
                SetProperty(ref _State, value);
                if (this._eventAggregator != null)
                    this._eventAggregator.GetEvent<Messages.ToggleLight>().Publish(value);
            }
        }
    }
}
